import { request } from '../http';

type SelectPaymentPayload = {
  OrderSn: string;
  payChannel: 'WeChatMiniPay';
};

export function selectPayment(payload: SelectPaymentPayload) {
  return request.post('/api/home/selectPayMode', payload);
}

export function getPaymentResult(orderSn: string) {
  request.options.loadingText = '正在确认支付结果';
  return request.post('/api/home/checkOrderSuccess', { orderSn });
}

export function payOrder(orderSn: string, payOrderSn?: string) {
  request.options.loadingText = '支付中';
  return request.post('/api/home/payOrder', { orderSn, payOrderSn });
}
